package bean;

import java.sql.Connection;
import java.sql.DriverManager;


public class DB {
	private Connection con;
	
	private static String classname = "com.mysql.jdbc.Driver";
	private static String url = "jdbc:mysql://localhost:3306/projectdb";

	public DB() {
	}

	public Connection getCon() {
		try {
			Class.forName(classname);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		try {
			con = DriverManager.getConnection(url, "root", "root");
		} catch (Exception e) {
			e.printStackTrace(System.err);
			con = null;
		}
		return con;
	}
}
